package com.tiny.tests;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;

import com.tiny.core.game.Game;
import com.tiny.core.input.KeyboardManager;
import com.tiny.gui.utils.CenteredText;

public class GuiTests extends Game {

    private CenteredText centeredText;
    @Override
    public void onLoad() {
        Font f = new Font("arial", Font.BOLD, 20);
        centeredText = new CenteredText(300, 40, 30, 30, "C T", f, Color.BLACK);
    }

    @Override
    public void onUnload() {

    }

    @Override
    public void onUpdate(int currentTick) {
        if (KeyboardManager.getInstance().isHold(KeyEvent.VK_ESCAPE)) {
            terminate();
        }
    }

    @Override
    public void onRender(Graphics2D g) {
        g.setColor(Color.WHITE);
        g.fillRect(30, 30, 300, 40);
        centeredText.render(g);
    }

    @Override
    public String getTitle() {
        return "GUI Test";
    }

    public static void main(String[] args) {
        new GuiTests().run();
    }
}